package stardust.product.spider;

import java.net.MalformedURLException;
import java.net.URL;

public interface URLSource
{

	URLEntity next() throws InterruptedException;
	
	boolean hasMore();
	
	public static class URLEntity
	{
		
		private String url;
		
		private String referer;
		
		public URLEntity(String url)
		{
			this(url, null);
		}
		
		public URLEntity(String url, String referer)
		{
			this.url = url;
			this.referer = referer;
		}
		
		public URL addressToURL() throws MalformedURLException
		{
			return new URL(this.url);
		}
		
		public URL refererToURL() throws MalformedURLException
		{
			return new URL(this.referer);
		}

		public String getUrl()
		{
			return this.url;
		}

		public void setUrl(String url)
		{
			this.url = url;
		}

		public String getReferer()
		{
			return this.referer;
		}

		public void setReferer(String referer)
		{
			this.referer = referer;
		}

	}

}
